using Furion.DatabaseAccessor;
using SqlSugar;

namespace Admin.NET.Application.Entity;

/// <summary>
/// 智能客服消息表
/// </summary>
[SugarTable("customer_service_message", "智能客服消息表")]
public class CustomerServiceMessage : EntityBaseDel
{
    /// <summary>
    /// 用户ID
    /// </summary>
    [SugarColumn(ColumnName = "user_id", ColumnDescription = "用户ID")]
    public long UserId { get; set; }

    /// <summary>
    /// 用户名
    /// </summary>
    [SugarColumn(ColumnName = "user_name", ColumnDescription = "用户名", Length = 64)]
    public string UserName { get; set; }

    /// <summary>
    /// 消息内容
    /// </summary>
    [SugarColumn(ColumnName = "message", ColumnDescription = "消息内容", ColumnDataType = "text")]
    public string Message { get; set; }

    /// <summary>
    /// 消息类型
    /// </summary>
    [SugarColumn(ColumnName = "message_type", ColumnDescription = "消息类型", Length = 32)]
    public string MessageType { get; set; } = "text";

    /// <summary>
    /// 时间戳
    /// </summary>
    [SugarColumn(ColumnName = "timestamp", ColumnDescription = "时间戳")]
    public DateTime Timestamp { get; set; }

    /// <summary>
    /// 是否来自用户
    /// </summary>
    [SugarColumn(ColumnName = "is_from_user", ColumnDescription = "是否来自用户")]
    public bool IsFromUser { get; set; }

    /// <summary>
    /// 对话ID
    /// </summary>
    [SugarColumn(ColumnName = "conversation_id", ColumnDescription = "对话ID", Length = 64)]
    public string ConversationId { get; set; }

    /// <summary>
    /// 操作建议
    /// </summary>
    [SugarColumn(ColumnName = "actions", ColumnDescription = "操作建议", ColumnDataType = "text", IsNullable = true)]
    public string? Actions { get; set; }
}

/// <summary>
/// 工单表
/// </summary>
[SugarTable("work_order", "工单表")]
public class WorkOrder : EntityBaseDel
{
    /// <summary>
    /// 工单编号
    /// </summary>
    [SugarColumn(ColumnName = "order_code", ColumnDescription = "工单编号", Length = 64)]
    public string OrderCode { get; set; }

    /// <summary>
    /// 用户ID
    /// </summary>
    [SugarColumn(ColumnName = "user_id", ColumnDescription = "用户ID")]
    public long UserId { get; set; }

    /// <summary>
    /// 用户名
    /// </summary>
    [SugarColumn(ColumnName = "user_name", ColumnDescription = "用户名", Length = 64)]
    public string UserName { get; set; }

    /// <summary>
    /// 工单标题
    /// </summary>
    [SugarColumn(ColumnName = "title", ColumnDescription = "工单标题", Length = 256)]
    public string Title { get; set; }

    /// <summary>
    /// 问题描述
    /// </summary>
    [SugarColumn(ColumnName = "description", ColumnDescription = "问题描述", ColumnDataType = "text")]
    public string Description { get; set; }

    /// <summary>
    /// 优先级
    /// </summary>
    [SugarColumn(ColumnName = "priority", ColumnDescription = "优先级", Length = 32)]
    public string Priority { get; set; } = "medium";

    /// <summary>
    /// 工单状态
    /// </summary>
    [SugarColumn(ColumnName = "status", ColumnDescription = "工单状态", Length = 32)]
    public string Status { get; set; } = "pending";

    /// <summary>
    /// 问题分类
    /// </summary>
    [SugarColumn(ColumnName = "category", ColumnDescription = "问题分类", Length = 32)]
    public string Category { get; set; } = "other";

    /// <summary>
    /// 分配给
    /// </summary>
    [SugarColumn(ColumnName = "assigned_to", ColumnDescription = "分配给", IsNullable = true)]
    public long? AssignedTo { get; set; }

    /// <summary>
    /// 分配人姓名
    /// </summary>
    [SugarColumn(ColumnName = "assigned_to_name", ColumnDescription = "分配人姓名", Length = 64, IsNullable = true)]
    public string? AssignedToName { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [SugarColumn(ColumnName = "create_time", ColumnDescription = "创建时间")]
    public new DateTime CreateTime { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    [SugarColumn(ColumnName = "update_time", ColumnDescription = "更新时间", IsNullable = true)]
    public new DateTime? UpdateTime { get; set; }

    /// <summary>
    /// 对话历史
    /// </summary>
    [SugarColumn(ColumnName = "conversation_history", ColumnDescription = "对话历史", ColumnDataType = "text", IsNullable = true)]
    public string? ConversationHistory { get; set; }

    /// <summary>
    /// 关联订单ID
    /// </summary>
    [SugarColumn(ColumnName = "related_order_id", ColumnDescription = "关联订单ID", IsNullable = true)]
    public long? RelatedOrderId { get; set; }

    /// <summary>
    /// 关联订单编号
    /// </summary>
    [SugarColumn(ColumnName = "related_order_code", ColumnDescription = "关联订单编号", Length = 64, IsNullable = true)]
    public string? RelatedOrderCode { get; set; }
}
